package com.app.service;

import cn.hutool.json.JSONObject;
import com.app.common.Result;
import com.app.model.AdminUserModel;
import com.app.model.UserModel;
import com.app.vo.UserVo;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import javax.security.auth.login.LoginException;
import java.util.List;

public interface UserService extends IService<UserModel>{
    UserVo getList(Integer page, Integer limit, String keyword, AdminUserModel user, String areaId, Integer identity,String beginTime,String endTime,Integer ifVip);

    com.alibaba.fastjson.JSONObject getUserAllCount(String keyword, AdminUserModel user, String areaId, Integer identity, String beginTime, String endTime);

    void updateStatus(Integer id, Integer status);

    UserModel getOpenid(String code) throws LoginException;

    String getPhone(String code) throws Exception;

    UserModel getUserByOpenid(String openId);
    @Transactional(rollbackFor = Exception.class)
    UserModel isTransferAccounts(UserModel beneficiary, Double transferAmount, UserModel user);
    @Transactional(rollbackFor = Exception.class)
    public void manuallyAssignInvitationRelationships(String orderSn,Integer userId);
    @Transactional(rollbackFor = Exception.class)
    void completeVip(String orderSn) throws Exception;
    @Transactional(rollbackFor = Exception.class)
    void generateInvitationCode(UserModel user);


    /**
     * 再生
     *
     * @param user 用户
     * @throws Exception 例外
     */
    void regenerate(UserModel user) throws Exception;

    Object upVip(String orderSn, String openId, String ip,UserModel user,Integer userId);


    UserModel getUserByInviteCode(String invitationCode);

    UserModel getUserByInviteCodeOrPhone(String invitationCode);

    void userGrant(Integer id, Double voucherAmount, Double integral);

    void setPaymentPassword(String paymentPassword, UserModel user);

    /**
     * 根据手机号查询收款对象信息
     *
     * @param phone
     * @return
     */
    UserModel getUserByPhone(String phone);

    List<JSONObject> userConsumptionVoucherStatistics(AdminUserModel roleId);

    /**
     * 查询用户数据（加权限）
     * @param mobile
     * @param cityId
     * @param areaId
     * @return
     */
    UserModel getUserInfoByOpenid(String mobile, String cityId, String areaId);

    /**
     * 生成美化二维代码
     *
     * @param userModel 用户模型
     * @return {@link Boolean }
     */
    public UserModel generateBeautifiedTwodimensionalCode(UserModel userModel);

    /**
     * 查询用户是否是刚刚成为会员
     * @param user
     * @return
     */
    Result ifBecomeVipJustNow(UserModel user);


    /**
     * 新增用户数据
     * @param userModel
     */


    //-------------------------------------------以上为项目初始化代码-------------------------------------------
    //-------------------------------------------以下为业务代码--------------------------------------------
}
